;; ----------------------------------------
;; YASnippet
;;
(add-to-list 'load-path "~/.emacs.d/site-lisp/yasnippet-0.6.1c/yasnippet.el")
(require 'yasnippet)
(setq yas/root-directory "~/.emacs.d/site-lisp/yasnippet-0.6.1c/snippets")
(yas/load-directory yas/root-directory)
(yas/initialize)

;; ----------------------------------------
;; Auto Complete
;;
;; (add-to-list 'load-path "~/.emacs.d/lisp/auto-complete-1.3.1")    ; This may not be appeared if you have already added.
;; (require 'auto-complete-config)
;; (add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
;; (ac-config-default)
;; (global-auto-complete-mode t)

;; (setq-default ac-sources '(ac-source-words-in-same-mode-buffers))
;; (add-hook 'emacs-lisp-mode-hook (lambda () (add-to-list 'ac-sources 'ac-source-symbols)))
;; (add-hook 'auto-complete-mode-hook (lambda () (add-to-list 'ac-sources 'ac-source-filename)))

;; (setq ac-auto-start 2)
;; (setq ac-dwim t)

;; ----------------------------------------
; hippie-expand
;;
(global-set-key [(meta ?/)] 'hippie-expand)
(setq hippie-expand-try-functions-list 
      '(try-expand-dabbrev
	try-expand-dabbrev-visible
	try-expand-dabbrev-all-buffers
	try-expand-dabbrev-from-kill
	try-complete-file-name-partially
	try-complete-file-name
	try-expand-all-abbrevs
	try-expand-list
	try-expand-line
	try-complete-lisp-symbol-partially
	try-complete-lisp-symbol))

;; ----------------------------------------
;; Auto pair
;;
(autoload 'autopair-global-mode "autopair" nil t)
(autopair-global-mode)
(add-hook 'lisp-mode-hook
          #'(lambda () (setq autopair-dont-activate t)))

;;
(add-hook 'python-mode-hook
          #'(lambda ()
              (push '(?' . ?')
                    (getf autopair-extra-pairs :code))
              (setq autopair-handle-action-fns
                    (list #'autopair-default-handle-action
                          #'autopair-python-triple-quote-action))))
